Skip to content

Split US and CA clients#2

Open
ibralu wants to merge 14 commits intomasterfrom
task/split-us-ca
Open

Split US and CA clients#2
ibralu wants to merge 14 commits intomasterfrom
task/split-us-ca

Conversation

@ibralu
Copy link
Copy Markdown
Contributor

@ibralu ibralu commented Dec 7, 2022

Notes:

  • @fluxxu Let me try ca/us shipping first but its implemented 1:1 with docs, CA shipping doesn't seem to return proper errors its always 400 with the same message, US should work fine
  • CA get released orders returns 404 even though its in spec and docs

Tasks:

  • Updated all dependencies and set edition to 2021
  • Separated us and ca client and some types
  • Removed deprecated api calls, see below for all changes
  • Changed to async
  • Updated cli to account for multiple clients and use derive clap
  • Changed format where applicable from JSON to XML
  • Added mocked tests for each call where applicable
  • Added openapi download cli, so maybe in the future we can switch to proper openapi spec, right now types are not 1:1 and schema has errors

Split us and ca clients example

api

let client = walmart_partner_api::ca::Client::new()
client.get_all_feed_statuses(walmart_partner_api::ca::GetAllFeedStatusesQuery)
client.get_all_feed_statuses(Default::default())

let client = walmart_partner_api::us::Client::new()
client.get_all_feed_statuses(Default::default())

cli

cargo run --bin cli --help
cargo run --bin cli us --help
cargo run --bin cli ca --help
cargo run --bin cli ca order ship --purchase-order-id SOMEID --line-number 1 --ship-from-country CA --ship-date-time 2022-04-19T20:27:44Z --method-code Standard --tracking-number SOMETRACKINGNUMBER                                        

Differences between current and previous version

  • Removed pregenerated reports for US, they are deprecated
  • Added on request reports for us, need to create request -> poll if finished -> get download url
  • Removed bulk feed upload for US
  • Added few extra apis
  • Extended and changed some types and api inputs

Possible improvements

  • Add retries
  • Add spans and propagate correlation id from it to walmart

@fluxxu
Copy link
Copy Markdown
Contributor

fluxxu commented Dec 8, 2022

Thanks!

Add retries

Retries should be handled by s2-mod. We just need to impl fn should_retry() -> bool for error types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants